package com.itheima.treemap;

import java.util.TreeMap;

public class A02_TreeMapDemo2 {
    public static void main(String[] args) {
        /*TreeMap集合：基本应用
        需求2:
        键：学生对象
        值：籍贯
        要求：按照学生年龄的升序排列，年龄一样按照姓名的字母排列，同姓名年龄视为同一个人。*/

        TreeMap<Student,String> tm = new TreeMap<>();
        Student s1 = new Student("zhangsan",23);
        Student s2 = new Student("lisi",24);
        Student s3 = new Student("wangwu",25);
        Student s4 = new Student("a7",24);

        tm.put(s1,"shanghai");
        tm.put(s2,"beijing");
        tm.put(s3,"tianjin");
        tm.put(s4,"shaoyang");

        System.out.println(tm);
    }
}
